//
//  SearchCollectionViewCell.m
//  FlowerRainGround
//
//  Created by lanou on 16/4/28.
//  Copyright © 2016年 lanou. All rights reserved.
//

#import "SearchCollectionViewCell.h"
#define kImageWidth self.size.width
@implementation SearchCollectionViewCell


- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.imageView = [[UIImageView alloc] initWithFrame:CGRectZero];
        [self.contentView addSubview:self.imageView];
        
        self.fnEnNameLabel = [[UILabel alloc] initWithFrame:CGRectZero];
        [self.contentView addSubview:self.fnEnNameLabel];
        
        self.fnNameLabel = [[UILabel alloc] initWithFrame:CGRectZero];
        [self.contentView addSubview:self.fnNameLabel];
        
        self.priceLabel = [[UILabel alloc] initWithFrame:CGRectZero];
        [self.contentView addSubview:self.priceLabel];
    }
    return self;
}


- (void)setMallmodel:(MallModel *)mallmodel
{
//    mallmodel = self.mallmodel;
    [self.imageView sd_setImageWithURL:[NSURL URLWithString:mallmodel.fnAttachment1]];
    self.fnEnNameLabel.text = mallmodel.fnEnName;
    self.fnNameLabel.text = mallmodel.fnName;
    self.priceLabel.text = [NSString stringWithFormat:@"%ld",mallmodel.fnMarketPrice];
}

- (void)layoutSubviews{
    [super layoutSubviews];
    
    self.imageView.frame = CGRectMake(0, 0, kImageWidth, kImageWidth);
    self.fnEnNameLabel.frame = CGRectMake(3, kImageWidth + 5, kImageWidth, 20);
    self.fnNameLabel.frame = CGRectMake(3, kImageWidth + 30, kImageWidth, 20);
    self.priceLabel.frame = CGRectMake(3, kImageWidth + 55, kImageWidth, 20);
}


@end
